home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / libz / newctime.0 < prev    next >
Encoding:
Text File  |  1989-12-28  |  4.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. NEWCTIME(3)            C LIBRARY FUNCTIONS            NEWCTIME(3)
  5.  
  6.  
  7.  
  8. NAME
  9.      ctime, localtime, gmtime, asctime, tzset, tzsetwall  -  con-
  10.      vert date and time to ASCII
  11.  
  12. SYNOPSIS
  13.      extern char *tzname[2];
  14.  
  15.      void tzset()
  16.  
  17.      void tzsetwall()
  18.  
  19.      char *ctime(clock)
  20.      long *clock;
  21.  
  22.      #include <time.h>
  23.  
  24.      char *asctime(tm)
  25.      struct tm *tm;
  26.  
  27.      struct tm *localtime(clock)
  28.      long *clock;
  29.  
  30.      struct tm *gmtime(clock)
  31.      long *clock;
  32.  
  33.      cc ... -lz
  34.  
  35. DESCRIPTION
  36.      _T_z_s_e_t uses the value of the environment variable TZ  to  set
  37.      time  conversion  information used by _l_o_c_a_l_t_i_m_e.  If TZ does
  38.      not appear in the environment, the best available approxima-
  39.      tion  to  local wall clock time is used by _l_o_c_a_l_t_i_m_e.  If TZ
  40.      appears in the environment but its value is a  null  string,
  41.      Greenwich Mean Time is used; if TZ appears and begins with a
  42.      slash,  it  is  used  as  the  absolute  pathname   of   the
  43.      _t_z_f_i_l_e(5)-format file from which to read the time conversion
  44.      information; if TZ appears and begins with a character other
  45.      than  a  slash, it's used as a pathname relative to a system
  46.      time conversion information directory.
  47.  
  48.      _T_z_s_e_t_w_a_l_l sets things up so that _l_o_c_a_l_t_i_m_e returns the  best
  49.      available approximation of local wall clock time.
  50.  
  51.      _C_t_i_m_e  converts  a  long  integer,  pointed  to  by   _c_l_o_c_k,
  52.      representing the time in seconds since 00:00:00 GMT, January
  53.      1, 1970, and returns a pointer to a 26-character  string  of
  54.      the form
  55.                      Thu Nov 24 18:22:48 1986\n\0
  56.      All the fields have constant width.
  57.  
  58.      _L_o_c_a_l_t_i_m_e and _g_m_t_i_m_e return pointers to  ``tm''  structures,
  59.      described  below.   _L_o_c_a_l_t_i_m_e corrects for the time zone and
  60.  
  61.  
  62.  
  63. Sun Release 4.0           Last change:                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. NEWCTIME(3)            C LIBRARY FUNCTIONS            NEWCTIME(3)
  71.  
  72.  
  73.  
  74.      any time zone adjustments (such as Daylight Savings time  in
  75.      the  U.S.A.).   Before  doing  so, _l_o_c_a_l_t_i_m_e calls _t_z_s_e_t (if
  76.      _t_z_s_e_t has not been called in the  current  process).   After
  77.      filling   in   the  ``tm''  structure,  _l_o_c_a_l_t_i_m_e  sets  the
  78.      tm_isdst'th element of tzname  to  a  pointer  to  an  ASCII
  79.      string  that's  the  time  zone abbreviation to be used with
  80.      _l_o_c_a_l_t_i_m_e's return value.
  81.  
  82.      _G_m_t_i_m_e converts to Greenwich Mean Time (GMT).
  83.  
  84.      _A_s_c_t_i_m_e converts a time value contained in a  ``tm''  struc-
  85.      ture  to  a 26-character string, as shown in the above exam-
  86.      ple, and returns a pointer to the string.
  87.  
  88.      Declarations of all the functions  and  externals,  and  the
  89.      ``tm''  structure,  are  in  the  <time.h> header file.  The
  90.      structure (of type) struct tm includes the following fields:
  91.  
  92.                int tm_sec;      /* seconds (0 - 59) */
  93.                int tm_min;      /* minutes (0 - 59) */
  94.                int tm_hour;     /* hours (0 - 23) */
  95.                int tm_mday;     /* day of month (1 - 31) */
  96.                int tm_mon;      /* month of year (0 - 11) */
  97.                int tm_year;     /* year - 1900 */
  98.                int tm_wday;     /* day of week (Sunday = 0) */
  99.                int tm_yday;     /* day of year (0 - 365) */
  100.                int tm_isdst;    /* is DST in effect? */
  101.                char *tm_zone;   /* abbreviation of timezone name */
  102.                long tm_gmtoff;  /* offset from GMT in seconds */
  103.  
  104.      The _t_m__z_o_n_e and _t_m__g_m_t_o_f_f fields exist, and are  filled  in,
  105.      only  if  arrangements  to  do so were made when the library
  106.      containing these functions was created.  There is no guaran-
  107.      tee that these fields will continue to exist in this form in
  108.      future releases of this code.
  109.  
  110.      _T_m__i_s_d_s_t is non-zero if a time zone adjustment such as  Day-
  111.      light Savings time is in effect.
  112.  
  113.      _T_m__g_m_t_o_f_f is the offset (in seconds) of the time represented
  114.      from GMT, with positive values indicating East of Greenwich.
  115.  
  116. FILES
  117.      /etc/zoneinfo            time zone information directory
  118.      /etc/zoneinfo/localtime  local time zone file
  119.  
  120. SEE ALSO
  121.      tzfile(5), getenv(3), time(2)
  122.  
  123. NOTE
  124.      The return values point to  static  data  whose  content  is
  125.      overwritten  by  each call.  The tm_zone field of a returned
  126.  
  127.  
  128.  
  129. Sun Release 4.0           Last change:                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. NEWCTIME(3)            C LIBRARY FUNCTIONS            NEWCTIME(3)
  137.  
  138.  
  139.  
  140.      struct tm points to a static array of characters, which will
  141.      also  be overwritten at the next call (and by calls to _t_z_s_e_t
  142.      or _t_z_s_e_t_w_a_l_l).
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sun Release 4.0           Last change:                          3
  196.  
  197.  
  198.  
  199.